package com.bilifuture.statemachine.message;

import java.util.Map;

/**
 * @author bilifuture
 * @description: 状态机中统一参数构建
 * @date 2022-02-23
 */
public class MessageReqBuilder {
    
    /**
     * 构建消息
     *
     * @param body body
     * @return {@link Message}
     */
    public static Message buildMessage(Object body){
        return Message.builder().body(body).build();
    }
    
    /**
     * 构建消息
     *
     * @param body  body
     * @param attrs attrs
     * @return {@link Message}
     */
    public static Message buildMessage(Object body, Map<String, Object> attrs){
        Message message = buildMessage(body);
        message.getAttrs().putAll(attrs);
        return message;
    }
    
    
}
